package com.plian.system.wrapper.pf;

import com.plian.system.dto.pf.TaskIndicatorsDTO;
import com.plian.system.entity.pf.TaskIndicators;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.pf.TaskIndicatorsVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.SPRING;
import static com.plian.system.wrapper.util.WrapperConstant.USER_ID_TO_NAME;

@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface TaskIndicatorsWrapper extends BaseWrapper<TaskIndicators, TaskIndicatorsDTO, TaskIndicatorsVO> {

    /**
     * Entity转VO
     *
     * @param entity /
     * @return /
     */
    @Override
    @Mappings(value = {
            @Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME)
    })
    TaskIndicatorsVO entityToVO(TaskIndicators entity);
}
